package com.lab.spring.topic2;

import org.springframework.beans.factory.annotation.Required;
import org.springframework.beans.factory.config.AbstractFactoryBean;

/**
 * Created with IntelliJ IDEA.
 * User: bsceran
 * Date: 5/22/13
 * Time: 9:27 AM
 * To change this template use File | Settings | File Templates.
 */
public class ProductCreator3  extends AbstractFactoryBean{
    private Product product;

    @Required
    public void setProduct(Product product) {
        this.product = product;
    }

    @Override
    public Class getObjectType() {
        return product.getClass();
    }

    @Override
    protected Object createInstance() throws Exception {
        return product;
    }
}
